
 
 O b j e c t :   p r o p s 
 
 
 
 D e s c r i p t i o n :   T h e   p r o p s   o b j e c t   i s   p a s s e d   a s   a   v a r i a b l e   t o   a l l   e x t e r n a l l y   i m p o r t e d   m o d u l e s   t o   s h a r e   p r o p e r t i e s ,   m e t h o d s ,   a n d   d a t a   b e t w e e n   c h a i n e d   d e p e n d a n c i e s . 
 
 
 
 N o t e :   W h e n   a   p r o p s   o b j e c t   i s   d e c l a r e d   u s i n g   t h e   $ A . i m p o r t ( )   s t a t e m e n t ,   t h e   p r o p s   o b j e c t   v a r i a b l e   i s   a u t o m a t i c a l l y   d e c l a r e d   w i t h i n   e v e r y   i m p o r t e d   m o d u l e   r e f e r e n c e d   b y   t h a t   s t a t e m e n t .   A s   s u c h ,   s e p a r a t e   i m p o r t   s t a t e m e n t s   c a n   b e   d e c l a r e d   o n e   a f t e r   t h e   o t h e r   a n d   m a y   i n c l u d e   d i f f e r e n t   p r o p s   w i t h i n   e a c h ,   e v e n   i f   t h e y   r e f e r e n c e   t h e   s a m e   e x t e r n a l   m o d u l e ,   t h e   p r o p s   t h a t   a r e   r e c e i v e d   b y   t h e   e x t e r n a l   m o d u l e   a r e   s a n d b o x e d   w i t h i n   t h e   m o d u l e   i n s t a n c e   f o r   e a c h   i n d i v i d u a l   i m p o r t   s t a t e m e n t .   A s   a   r e s u l t ,   i t   i s   i m p o s s i b l e   f o r   a n y   p r o p   c o n f l i c t s   t o   o c c u r   w h e n   r e f e r e n c i n g   t h e   s a m e   m o d u l e s   f r o m   d i f f e r i n g   i m p o r t   s t a t e m e n t s   u s i n g   d i f f e r e n t   v a r i a b l e s . 
 
 
 
 E x a m p l e 
 
 
 
 / /   I m p o r t   s t a t e m e n t   # 1 
 
 $ A . i m p o r t ( " M o d u l e N a m e " ,   { 
 
     p r o p s :   { 
 
         p o k e :   " S u r p r i s e ! " 
 
     } 
 
 } ) ; 
 
 
 
 / /   I m p o r t   s t a t e m e n t   # 2 
 
 $ A . i m p o r t ( " M o d u l e N a m e " ,   { 
 
     p r o p s :   { 
 
         p o k e :   " W o w ! " 
 
     } 
 
 } ) ; 
 
 
 
 / /   F i l e   c o n t e n t   f o r   " M o d u l e N a m e . j s "   w i t h i n   t h e   M o d u l e s   f o l d e r 
 
 a l e r t ( p r o p s . p o k e ) ; 
 
 
 
 R e s u l t : 
 
 
 
 D i a l o g   f r o m   i m p o r t   s t a t e m e n t   # 1 :   " S u r p r i s e ! " 
 
 [ F o l l o w e d   b y ]   D i a l o g   f r o m   i m p o r t   s t a t e m e n t   # 2 :   " W o w ! " 
 
 
 
 P a s s i n g   P r o p s 
 
 
 
 P r o p s   c a n   a l s o   b e   p a s s e d   b o t h   w a y s ,   i n t o   a n d   o u t   o f   e x t e r n a l l y   r e f e r e n c e d   m o d u l e s ,   a l l o w i n g   f o r   c u s t o m   c o n f i g u r a t i o n   t o   o c c u r   b e f o r e   t h e   p r o p s   a r e   u s e d   w i t h i n   t h e   o r i g i n a l   i m p o r t   s t a t e m e n t   v i a   t h e   c a l l b a c k   f u n c t i o n . 
 
 
 
 E x a m p l e 
 
 
 
 / /   F i l e   c o n t e n t   f o r   " M o d u l e N a m e . j s "   w i t h i n   t h e   M o d u l e s   f o l d e r 
 
 p r o p s . n u m b e r   + =   2 ; 
 
 
 
 / /   I m p o r t   s t a t e m e n t 
 
 $ A . i m p o r t ( " M o d u l e N a m e " ,   { 
 
     p r o p s :   { 
 
         n u m b e r :   1 
 
     } , 
 
     c a l l :   f u n c t i o n ( p r o p s )   { 
 
         a l e r t ( p r o p s . n u m b e r ) ;   / /   S h o w s   i n   d i a l o g :   " 3 " 
 
     } 
 
 } ) ; 
 
 
 
 C h a i n i n g   P r o p s 
 
 
 
 W h e n   p a s s i n g   p r o p s ,   i t   i s   a l s o   p o s s i b l e   t o   p a s s   t h e   s a m e   p r o p s   b e t w e e n   m u l t i p l e   m o d u l e s ,   e v e n   w h e n   t h e s e   p r o p s   a r e   c h a i n e d   t o g e t h e r   t o   r e f e r e n c e   d i f f e r i n g   m o d u l e   d e p e n d a n c i e s . 
 
 
 
 E x a m p l e 
 
 
 
 / /   F i l e   c o n t e n t   f o r   " M o d u l e N a m e 1 . j s "   w i t h i n   t h e   M o d u l e s   f o l d e r 
 
 p r o p s . n u m b e r   + =   2 ; 
 
 $ A . i m p o r t ( " M o d u l e N a m e 2 " ,   { 
 
     p r o p s :   p r o p s , 
 
     c a l l :   f u n c t i o n ( p r o p s )   { 
 
         a l e r t ( p r o p s . n u m b e r ) ; 
 
     } 
 
 } ) ; 
 
 
 
 / /   F i l e   c o n t e n t   f o r   " M o d u l e N a m e 2 . j s "   w i t h i n   t h e   M o d u l e s   f o l d e r 
 
 p r o p s . n u m b e r   + =   2 ; 
 
 
 
 / /   I m p o r t   s t a t e m e n t 
 
 $ A . i m p o r t ( " M o d u l e N a m e 1 " ,   { 
 
     p r o p s :   { 
 
         n u m b e r :   1 
 
     } 
 
 } ) ; 
 
 
 
 R e s u l t : 
 
 
 
 S h o w s   i n   d i a l o g :   " 5 " 
 
 